import {createBrowserRouter, Navigate} from "react-router-dom";
import Home from "../pages/Home";
import News from "../pages/News";
import Index from "../pages/Index";
import FindHouse from "../pages/FindHouse";
import Profile from "../pages/Profile";
import CityList from "../pages/CityList";
import Search from "../pages/Search";
import Map from "../pages/Map";

const router = createBrowserRouter([
    {
        path: '/',
        element: <Navigate to="/home"/>
    },

    {
        path: '/home',
        element: <Home/>,
        children: [
            {
                index: true,
                element: <Index/>
            },
            {
                path: 'findHouse',
                element: <FindHouse/>
            },
            {
                path: 'news',
                element: <News/>
            },
            {
                path: 'profile',
                element: <Profile/>
            },
            {
                path: 'jointHouse',
                element: <Navigate to="/home/findHouse"/>
            },
        ]
    },

    {
        path: '/cityList',
        element: <CityList/>
    },

    {
        path: '/search',
        element: <Search/>
    },

    {
        path: '/map',
        element: <Map/>
    }

]);

export {router}